/// [Integer right triangles](https://projecteuler.net/problem=39)
fn main() {
    let mut count = vec![0; 1000];
    for a in 1_usize..=333 {
        for b in a..=(666 - a) {
            for c in b..(a + b) {
                let sum = a + b + c - 1;
                if sum >= 1000 {
                    break;
                } else if c.pow(2) == a.pow(2) + b.pow(2) {
                    count[sum] += 1;
                }
            }
        }
    }
    println!("120: {}", count[119]);
    if let Some((idx, num)) = count.iter().enumerate().max_by_key(|(_, n)| *n) {
        println!("{}: {}", idx + 1, num);
    }
}
